import myaxios from '../../utils/myaxios'
import {GET_SWIPER_IMG,GET_CLASSIFY,GET_IMG} from '../actionType'
const getIndexSwiperImg = () => {
  return (dispatch)=>{
    myaxios.get("/home/swiperdata").then((res)=>{
        dispatch({
          type:GET_SWIPER_IMG,
          payload:{
            swiperList:res
          }
        })
    }).catch((err)=>{console.log(err)})
  }
}

 const getIndexClassify = () => {
   return (dispatch)=>{
     myaxios.get("home/catitems").then((res)=>{
          dispatch({
            type:GET_CLASSIFY,
            payload:{
              classifyList:res
            }
          })
     }).catch((err)=>{console.log(err)})
   }
 }

 const getIndexImg = () => {
  return (dispatch)=>{
    myaxios.get("home/floordata").then((res)=>{
         dispatch({
           type:GET_IMG,
           payload:{
            imgList:res
           }
         })
    }).catch((err)=>{console.log(err)})
  }
}

export {getIndexSwiperImg,getIndexClassify,getIndexImg}
